package com.espirit.builder.biz;

import org.springframework.stereotype.Component;

import com.espirit.eap.manager.ModelBuilderSupport;
import com.espirit.eap.manager.workflow.WFInstanceTracker;
import com.espirit.eap.pagelayout.ModelField;
@Component
public class WFInstanceTrackerBuilder extends ModelBuilderSupport {
	private static final String FIELD_USER= "user";
	private static final String FIELD_CURRENTPHASE = "parent.wfPhase";
	private static final String FIELD_REMARK ="remark";
	private static final String FIELD_CREATEDON ="createdOn";
	private static final String FIELD_MODIFYON ="modifyOn";
	private static final String FIELD_STATUS = "status";
	
	@Override
	public boolean init() {
		return super.setClass(WFInstanceTracker.class, "Approving Process", "审批信息") ;
	}
	
	@Override
	public void buildFields() {
		addModelField(FIELD_STATUS, "Decide", "决定");
		addModelField(FIELD_USER, "Receiver", "接收者");
		addModelField(FIELD_CREATEDON, "Received Date", "接收时间");
		addModelField(FIELD_MODIFYON, "Process Date", "处理时间");
		
		addModelField(FIELD_CURRENTPHASE, "Phase Name", "审批阶段");
		addModelField(FIELD_REMARK, "Approve remark", "审批意见");
	}
	
	@Override
	public void prepareLayoutElements() {
		ModelField mfStatus = getModelField(FIELD_STATUS);
		ModelField mfUser = getModelField(FIELD_USER);
		ModelField mfPhase = getModelField(FIELD_CURRENTPHASE);
		ModelField mfDescription = getModelField(FIELD_REMARK);
		ModelField mfCreatedOn = getModelField(FIELD_CREATEDON);
		ModelField mfModifyOn = getModelField(FIELD_MODIFYON);
		
		addListField(mfStatus,mfPhase,mfUser,mfCreatedOn,mfModifyOn,mfDescription);
		super.prepareLayoutElements();
	}
	
	@Override
	protected void setDefaultLayoutButtons() {
	}
}
